//
//  RegisterViewController.m
//  CatMusic
//
//  Created by dllo on 15/4/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RegisterViewController.h"
#import "LandViewController.h"
@interface RegisterViewController ()
@property (nonatomic , retain)UITextField *userNameText;
@property (nonatomic , retain)UITextField *passWordText;
@property (nonatomic , retain)UITextField *surePassWordText;
@property (nonatomic , retain)UITextField *PhoneText;
@property (nonatomic , retain)UITextField *e_mail;
@property (nonatomic , assign)BOOL result;
@end

@implementation RegisterViewController
- (void)dealloc
{
    [_userNameText release];
    [_passWordText release];
    [_surePassWordText release];
    [_PhoneText release];
    [_e_mail release];
    [super dealloc];
}
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"注册";
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor purpleColor];
    // Do any additional setup after loading the view.
    
    
    // 用户名
    UILabel *userName = [[UILabel alloc]initWithFrame:CGRectMake(40, 140, 100, 40)];
    userName.text = @"用户名";
    userName.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:userName];
    
    self.userNameText = [[UITextField alloc]initWithFrame:CGRectMake(140, 140, 200, 40)];
    self.userNameText.placeholder = @"请输入用户名";
    self.userNameText.textAlignment = NSTextAlignmentCenter;
    self.userNameText.layer.borderWidth = 1;
    self.userNameText.layer.cornerRadius = 5;
    [self.view addSubview:self.userNameText];
    
    // 密码
    UILabel *passWord = [[UILabel alloc]initWithFrame:CGRectMake(40, 200, 100, 40)];
    passWord.text = @"密码";
    passWord.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:passWord];
    
    self.passWordText = [[UITextField alloc]initWithFrame:CGRectMake(140, 200, 200, 40)];
    self.passWordText.placeholder = @"请输入用户密码";
    self.passWordText.textAlignment = NSTextAlignmentCenter;
    self.passWordText.layer.borderWidth = 1;
    self.passWordText.layer.cornerRadius = 5;
    [self.view addSubview:self.passWordText];
    
    // 确定密码
    UILabel *surePassWord = [[UILabel alloc]initWithFrame:CGRectMake(40, 260, 100, 40)];
    surePassWord.text = @"确定密码";
    surePassWord.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:surePassWord];
    
    self.surePassWordText = [[UITextField alloc]initWithFrame:CGRectMake(140, 260,200, 40)];
    self.surePassWordText.placeholder = @"请再次确认";
    self.surePassWordText.textAlignment = NSTextAlignmentCenter;
    self.surePassWordText.layer.borderWidth = 1;
    self.surePassWordText.layer.cornerRadius = 5;
    [self.view addSubview:self.surePassWordText];
    
    // 联系方式
    UILabel *PhoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(40, 320, 100, 40)];
    PhoneLabel.text = @"联系方式";
    PhoneLabel.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:PhoneLabel];
    
    self.PhoneText = [[UITextField alloc]initWithFrame:CGRectMake(140, 320, 200, 40)];
    self.PhoneText.placeholder = @"请输入联系方式";
    self.PhoneText.textAlignment = NSTextAlignmentCenter;
    self.PhoneText.layer.borderWidth = 1;
    self.PhoneText.layer.cornerRadius = 5;
    [self.view addSubview:self.PhoneText];
    
    // 邮箱
    UILabel *e_mailLabel = [[UILabel alloc]initWithFrame:CGRectMake(40, 380, 100, 40)];
    e_mailLabel.text = @"邮箱";
    e_mailLabel.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:e_mailLabel];
    
    self.e_mail = [[UITextField alloc]initWithFrame:CGRectMake(140, 380, 200, 40)];
    self.e_mail.placeholder = @"请输入邮箱";
    self.e_mail.textAlignment = NSTextAlignmentCenter;
    self.e_mail.layer.borderWidth = 1;
    self.e_mail.layer.cornerRadius = 5;
    [self.view addSubview:self.e_mail];
    
    
    
    UIButton *bu1 = [UIButton buttonWithType:UIButtonTypeSystem];
    bu1.frame = CGRectMake(70, 480, 80, 40);
    bu1.layer.borderWidth = 1;
    bu1.layer.cornerRadius = 5;
    [bu1 setTitle:@"确定" forState:UIControlStateNormal];
    [bu1 addTarget:self action:@selector(bu1Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bu1];
    
    UIButton *bu2 = [UIButton buttonWithType:UIButtonTypeSystem];
    bu2.frame = CGRectMake(220, 480, 80, 40);
    bu2.layer.borderWidth = 1;
    bu2.layer.cornerRadius = 5;
    [bu2 setTitle:@"返回" forState:UIControlStateNormal];
    [bu2 addTarget:self action:@selector(bu2Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bu2];

    
    
    
    
    
    
    
    
    
    
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.userNameText resignFirstResponder];
    [self.passWordText resignFirstResponder];
    [self.surePassWordText resignFirstResponder];
    [self.PhoneText resignFirstResponder];
    [self.e_mail resignFirstResponder];
}
- (void)bu1Action:(UIButton *)button
{
    LandViewController *landVC = [[LandViewController alloc]init];
    [self.navigationController pushViewController:landVC animated:YES];
}

#warning   UIActionSheet研发中!!!!!
- (void)bu2Action:(UIButton *)button
{
    UIActionSheet *action = [[UIActionSheet alloc]initWithTitle:@"是否放弃本次编辑" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:nil, nil];
    self.result = YES;
    if (self.result == YES) {
        LandViewController *landVC = [[LandViewController alloc]init];
        [self.navigationController pushViewController:landVC animated:YES];
    }
    [action showInView:self.view];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
